package com.woniu.airent.service.impl;

import com.github.pagehelper.PageHelper;
import com.github.pagehelper.PageInfo;
import com.woniu.airent.dto.HouseDto;
import com.woniu.airent.entity.House;
import com.woniu.airent.mapper.PublishHouseMapper;
import com.woniu.airent.service.PublishHouseService;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.stereotype.Service;

import java.util.List;

@Service
public class PublishHouseServiceImpl implements PublishHouseService {
    @Autowired
    PublishHouseMapper publishHouseMapper;
    @Override
    public PageInfo<House> publishHouse(String content, int pageNow, int pageSize) {
        PageHelper.startPage(pageNow,pageSize);
        List<House> houses=publishHouseMapper.publishHouse(content);
        return new PageInfo<>(houses);
    }

    public HouseDto findHouseById(Integer hid) {
        HouseDto houseDto=publishHouseMapper.selectHouseById(hid);
        return houseDto;
    }
}
